<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/8/19 19:25
 * Modified Time: 2019/8/19 19:25
 * Version: 2.0
 */

namespace App\Modules\System\Controllers;


use App\Lib\Utilities;
use App\Modules\System\Services\ShareService;
use Flower\Core\Http\BaseController;
use Illuminate\Http\Request;

class ShareController extends BaseController
{
    protected $shareService;

    public function __construct(ShareService $shareService)
    {
        $this->shareService = $shareService;
    }

    public function getRules()
    {
        return [
            'sharePortfolio' => [
                'portfolio_id' => [
                    'title' => '作品集id',
                    'rule' => 'required',
                    'message' => []
                ]
            ],
            'shareStore' => [
                'store_id' => [
                    'title' => '店铺id',
                    'rule' => 'required',
                    'message' => []
                ]
            ],
            'shareActivity' => [
                'activity_id' => [
                    'title' => '活动id',
                    'rule' => 'required',
                    'message' => []
                ]
            ],
            'shareBarber' => [
                'store_id' => [
                    'title' => '店铺id',
                    'rule' => 'required',
                    'message' => []
                ],
                'barber_id' => [
                    'title' => '理发师id',
                    'rule' => 'required',
                    'message' => []
                ],
            ],
        ];
    }

    public function sharePortfolio(Request $request)
    {
        $portfolio_id = $request->input('portfolio_id');

        $path = $this->shareService->sharePortfolio($portfolio_id);

        return $this->display($path);

    }

    public function shareStore(Request $request)
    {
        $store_id = $request->input('store_id');

        $path = $this->shareService->shareStore($store_id);

        return $this->display($path);

    }

    public function shareActivity(Request $request)
    {
        $activity_id = $request->input('activity_id');

        $path = $this->shareService->shareActivity($activity_id);

        return $this->display($path);

    }

    public function shareBarber(Request $request)
    {
        $barber_id = $request->input('barber_id');
        $store_id = $request->input('store_id');

        $path = $this->shareService->shareBarber($barber_id, $store_id);

        return $this->display($path);

    }


	public function wxPathCode(){
    	$res = $this->shareService->WxAppPath();
    	return $this->display($res);
	}
}